package com.mach.platform.utils;

import com.google.common.cache.Cache;
import com.google.common.cache.CacheBuilder;

import java.util.concurrent.TimeUnit;

/**
 * @Description: 缓存--主要是 guava cache
 * @Package: com.ems.utils
 * @Info Anonymous create on 2018/01/24 10:25
 */
public class CacheUtils {

	/**
	 * expireAfterWrite:设置cache中的数据在写入之后的存活时间为10minute
	 */
	public final static Cache<String, Object> guavaCacheFactory = CacheBuilder.newBuilder().initialCapacity(1000)
			.concurrencyLevel(500).expireAfterWrite(10, TimeUnit.MINUTES).build();

    /**
     * EMS页面缓存
     */
    public final static Cache<String, Object> guavaCacheFactoryEMS = CacheBuilder.newBuilder().initialCapacity(1000)
			.concurrencyLevel(500).expireAfterWrite(24, TimeUnit.HOURS).build();

}
